Dynomotion

Group: DynoMotion Message: 3089 From: gracemckay Date: 1/12/2012
Subject: Limit Switches
I have been fiddling with a limit switch on Axis2 of the scanner. So far, I have a physical switch on the axis, connected to power pin 24 on J7, and the other side of the switch to pin 7. The switch in Normally Open, so when it is tripped it puts 5v on pin 7. In the digital I/O screen of Kmotion, I see see I/O 0 and 1 toggle state when the switch in pressed.

In the C-Code screen I have tried this code

#include "KMotionDef.h"
main()
{

Jog(2,2000); // start moving
while (ReadBit(0)) ; // wait for switch (input #0) to change
Jog(2,0); // StopMotion

}

In the Config screen, I have Positive Watch Limit checked, and bit 0 selected, with the Action set to Stop Movement. This give me a line in the c code of this: ch2->LimitSwitchOptions=0x22; When this is executed, I get this line repeated over and over in the console screen: "Pos Limit Stop Axis:2"

So far, I don't have it working. What am I doing wrong?

Grace McKay
Group: DynoMotion Message: 3099 From: Tom Kerekes Date: 1/12/2012
Subject: Re: Limit Switches
Hi Grace,
 
Several things:
 
Switching the inputs directly to +5V is not ideal.  It won't cause any damage but there is an issue with pulling inputs above 3.3V (or actually 3.8V) causes leakage between pins due to the internal clamping in the FPGA between pin pairs.  I recently became aware of this and there is a big app note about it on the Xilinx web site.  I don't think this is your main issue but consider switching to 3.3V instead.  Or use a resistor divider.
 
In your arrangement the switch will pull the pin high when closed.  But when open the pin will be just 'floating" as an open circuit.  There is no guarantee the voltage will drop low.  So a pull down resistor should be added to assure the pin goes low.  Actually the first 8 pins on JP4 and JP6 have 150 ohm pull down resistors so you might consider switching to those.  But make sure you do not directly switch those to 5V unless you add a 100ohm series resistor.
 
Please use "Kill Motor Drive" or "Disallow Drive Into Limit" instead of "Stop Movement".
 
The C code is using the input as a home switch and will stop the axis when the switch is detected so you should not have limits enabled while running the home program.
 
Regards
TK
 

Group: DynoMotion Message: 3102 From: gracemckay Date: 1/13/2012
Subject: Re: Limit Switches
Thanks Tom, I have ordered the JP4/JP6 breakouts from Winford. I will try this wiring when they arrive. I will cut the voltage to the pins to what, around 3 volts?

Grace



--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Grace,
>  
> Several things:
>  
> Switching the inputs directly to +5V is not ideal.  It won't cause any damage but there is an issue with pulling inputs above 3.3V (or actually 3.8V) causes leakage between pins due to the internal clamping in the FPGA between pin pairs.  I recently became aware of this and there is a big app note about it on the Xilinx web site.  I don't think this is your main issue but consider switching to 3.3V instead.  Or use a resistor divider.
>  
> In your arrangement the switch will pull the pin high when closed.  But when open the pin will be just 'floating" as an open circuit.  There is no guarantee the voltage will drop low.  So a pull down resistor should be added to assure the pin goes low.  Actually the first 8 pins on JP4 and JP6 have 150 ohm pull down resistors so you might consider switching to those.  But make sure you do not directly switch those to 5V unless you add a 100ohm series resistor.
>  
> Please use "Kill Motor Drive" or "Disallow Drive Into Limit" instead of "Stop Movement".
>  
> The C code is using the input as a home switch and will stop the axis when the switch is detected so you should not have limits enabled while running the home program.
>  
> Regards
> TK
>  
>
> From: gracemckay <grace@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, January 12, 2012 2:37 PM
> Subject: [DynoMotion] Limit Switches
>
>
>  
> I have been fiddling with a limit switch on Axis2 of the scanner. So far, I have a physical switch on the axis, connected to power pin 24 on J7, and the other side of the switch to pin 7. The switch in Normally Open, so when it is tripped it puts 5v on pin 7. In the digital I/O screen of Kmotion, I see see I/O 0 and 1 toggle state when the switch in pressed.
>
> In the C-Code screen I have tried this code
>
> #include "KMotionDef.h"
> main()
> {
>
> Jog(2,2000); // start moving
> while (ReadBit(0)) ; // wait for switch (input #0) to change
> Jog(2,0); // StopMotion
>
> }
>
> In the Config screen, I have Positive Watch Limit checked, and bit 0 selected, with the Action set to Stop Movement. This give me a line in the c code of this: ch2->LimitSwitchOptions=0x22; When this is executed, I get this line repeated over and over in the console screen: "Pos Limit Stop Axis:2"
>
> So far, I don't have it working. What am I doing wrong?
>
> Grace McKay
>
Group: DynoMotion Message: 3105 From: Tom Kerekes Date: 1/13/2012
Subject: Re: Limit Switches
Hi Grace,
 
Yes 3V sounds good.
 
TK